package com.cxrj.zhsq.payManage.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.cxrj.zhsq.payManage.entity.PropertyBill;
import com.cxrj.zhsq.payManage.service.PropertyBillService;

@RestController
public class PropertyBillController {

	@Resource
	private PropertyBillService propertyBillService;

	/**
	 * 分页查询账单
	 * 
	 * @return
	 */
	@RequestMapping(value = "selectPropertyBills", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public Map<String, Object> selectPropertyBills(HttpServletRequest request, HttpServletResponse response) {
		return propertyBillService.selectPropertyBill(request, response);
	}

	/**
	 * 添加租借类型
	 * 
	 * @return
	 */
	@RequestMapping(value = "insertPropertyBill", method = RequestMethod.POST)
	public Map<String, Object> insertPropertyBill(PropertyBill propertyBill, HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			resultMap = propertyBillService.insertPropertyBill(propertyBill, request);
		} catch (Exception e) {
			resultMap.put("result", 0);
			e.printStackTrace();
		}
		return resultMap;
	}
}
